<template>
  <div style="margin:10px">
     <el-tag closable 
        v-for="item in historyAry" 
        :key="item.path" 
        @click="selectTab(item.path)"
        @close="closeTab(item.title)">
            {{item.title}}
        
        </el-tag>
  </div>
</template>

<script>
import {createNamespacedHelpers} from 'vuex'
const {mapState:mapHistoryState,mapMutations:mapHistoryMutations}=createNamespacedHelpers('history')
export default {
    computed:{
        ...mapHistoryState(['historyAry'])
    },
    methods:{
        ...mapHistoryMutations(['REMOVE_TABS']),
        selectTab(path){
           this.$router.push(path)
        },
        closeTab(title){
            console.log(title);
            this.REMOVE_TABS(title)
            //console.log('ccc',this.historyAry[this.historyAry.length-1].path);
            this.$router.push(this.historyAry[this.historyAry.length-1].path)
        }
    }
}
</script>

<style>

</style>